
class OuterClass {
    public int data1 = 1;
    private int data2 = 2;
    public static int data3 = 3;

    class InnerClass {

        public int data1 = 111111;
        public int data4 = 4;
        private int data5 = 5;
        //常量是在编译的时候 确定的
        public static final int data6 = 6;

        public void test() {
            System.out.println(OuterClass.this.data1);
            System.out.println(this.data1);
            System.out.println(data1);
            System.out.println(data2);
            System.out.println(data3);
            System.out.println(data4);
            System.out.println(data5);
            System.out.println(data6);
            System.out.println("test()");
        }
    }

    public void func() {
        InnerClass innerClass = new InnerClass();
        innerClass.test();
    }
}
    public class Test {
        public static void main(String[] args) {
//            OuterClass outerClass = new OuterClass();
//            System.out.println(outerClass.data1);
            OuterClass out =new OuterClass();
              //out.func();
            OuterClass.InnerClass innerClass= out.new InnerClass();//法一
            OuterClass.InnerClass innerClass1 = new OuterClass().new InnerClass();//法二
            innerClass.test();
        }
    }
